package pl.perseus.dao;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import pl.perseus.model.Rach;
import pl.perseus.model.User;

@Repository
public class RachDao extends BaseDao<Rach> implements IRachDao{
 
	
	public RachDao() {
		super("Rach");
	}

	@Override
    public Rach selectByIdRach(Long id) {
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("id", id);
        return queryForObject("getByIDRach", map);
    }
	
	@Override
	public Rach insertRach(Rach rach){
		return insertBean("insertRach", rach);
	}
	
	@Override
	public Rach updateRach(Rach rach){
		return updateBean("updateRach", rach);
	}
	
	@Override
	public List<Rach> getRachsForUser(User user){
		Map<String, Object> map = new HashMap<String, Object>();
    	map.put("userId", user.getId());
    	return queryForList("getRachsForUser", map);
	}
	
	@Override
	public List<Rach> getAll(){
		
		return queryForList("getAllRachs", new HashMap<String, Object>());
	}
 
}
